Getting an object instead of a boolean value